//
//  userDefault.h
//  SXH-Bridge
//
//  Created by sxh on 2020/9/9.
//  Copyright © 2020 yuxin. All rights reserved.
//

#import <UIKit/UIKit.h>
typedef void(^JSCallBack)(id _Nullable result, BOOL complete);

NS_ASSUME_NONNULL_BEGIN

@interface BaseFunction : NSObject

#pragma mark - 判断设备类型ios Android
- (NSString *)mobileType:(NSString *)key;
- (void)mobileType:(NSString *)key :(JSCallBack)completionHander;

#pragma mark - 数据获取
/// 同步获取存储数据 key：存储的键名
- (NSString *)getItem:(NSString *)key;
/// 异步获取存储数据 key：存储的键名 completionHander：异步回调
- (void)getItem:(NSString *)key :(JSCallBack)completionHander;

#pragma mark - 数据存储
/// 同步存储数据 obj：前端对象{存储的键名:存储的值(或对象)}
- (NSString *)setItem:(id)obj;
/// 异步存储数据 obj：前端对象{存储的键名:存储的值(或对象)} completionHandler：异步回调
- (void)setItem:(id)obj :(JSCallBack)completionHandler;

#pragma mark - fly请求拦截
- (void)onAjaxRequest:(id)request :(JSCallBack)completeHandle;

#pragma mark - 打电话
- (NSString *)callPhone:(NSString *)mobile;
- (void)callPhone:(NSString *)mobile :(JSCallBack)completeHandle;

#pragma mark - 获取设备信息
- (NSString *)getDeviceInfo:(NSString *)info;
- (void)getDeviceInfo:(NSString *)info :(JSCallBack)completeHandle;

#pragma mark - 获取推送的token
- (NSString *)getDeviceToken:(NSString *)info;
- (void)getDeviceToken:(NSString *)info :(JSCallBack)completeHandle;

#pragma mark - 打开新的web页
- (NSString *)openFrame:(id)options;
- (void)openFrame:(id)options :(JSCallBack)completeHandle;

#pragma mark - 获取注入前端的参数
- (NSString *)getParams:(NSString *)params;
- (void)getParams:(NSString *)params :(JSCallBack)completeHandle;

#pragma mark - 关闭当前页面
- (NSString *)closeView:(NSString *)params;
- (void)closeView:(NSString *)params :(JSCallBack)completeHandle;

#pragma mark - 获取状态栏高度
- (NSString *)getStatusHeight:(NSString *)key;
- (void)getStatusHeight:(NSString *)key :(JSCallBack)completeHandle;

#pragma mark - 获取应用更新
//- (NSString *)getAppUpdate:(id)obj;
- (void)getWebAppUpdate:(id)updateInfo :(JSCallBack)completeHandle;

#pragma mark - 获取本地当前web信息
- (NSString *)getWebInfo:(NSString *)key;
- (void)getWebInfo:(NSString *)key :(JSCallBack)completeHandle;

#pragma mark - 调起相机或者相册
///options obj = {type:'相机或者相册',maxSelectCount:'可选择相片数量最高9张',saveNewImageAfterEdit:'编辑图片后是否保存'}
- (void)takePhoto:(id)options :(JSCallBack)completeHandle;
- (void)getPhotos:(id)options :(JSCallBack)completeHandle;

#pragma mark - 调起二维码识别功能
//- (NSString *)recognitionCode:(NSString *)key;
- (void)recognitionCode:(NSString *)key :(JSCallBack)completeHandle;

#pragma mark - 清除当前缓存
- (NSString *)cleanCache:(NSString *)key;
- (void)cleanCache:(NSString *)key :(JSCallBack)completeHandle;

#pragma mark - 跳转web页
- (NSString *)jumpFrame:(id)options;
- (void)jumpFrame:(id)options :(JSCallBack)completeHandle;

#pragma mark - 地图定位
//- (NSString *)location:(id)options;
- (void)location:(id)options :(JSCallBack)completeHandle;
@end

NS_ASSUME_NONNULL_END
